#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>

using namespace std;

int main()
{
	int n;
	int a, b, c;
	int count = 0;
	cin >> n;
	while (n--)
	{
		count = 0;
		cin >> a >> b >> c;
		int tmp = min(min(a, b), c);
		count += tmp * 2;
		tmp = max(b - tmp - 1, 0);
		count += tmp;
		cout << count << endl;
	}

	return 0;
}